//
//  AppDelegate.m
//  ZiJinLian
//
//  Created by lzy on 2017/3/7.
//  Copyright © 2017年 lzy. All rights reserved.
//

#import "AppDelegate.h"
#import "ZJLoginViewController.h"
#import "ZJHomeViewController.h"
#import "ZJClassifyViewController.h"
#import "ZJShopCarViewController.h"
#import "ZJMineViewController.h"
#import "XNGuideView.h"
#import "ShopDetailViewController.h"
#import <UMSocialCore/UMSocialCore.h>
#import <UserNotifications/UserNotifications.h>
#import <UMMobClick/MobClick.h>
@interface AppDelegate ()<EMChatManagerDelegate,WXApiDelegate,QQApiInterfaceDelegate,TencentSessionDelegate,UNUserNotificationCenterDelegate,EMClientDelegate>

@property (nonatomic ,strong)UIImageView* welcomImg;
@end

@implementation AppDelegate



- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
	
	
	application.statusBarHidden = NO;
    /*友盟的统计 跟崩溃*/
    [[UMSocialManager defaultManager] openLog:YES];
    
    /* 设置友盟appkey */
    [[UMSocialManager defaultManager] setUmSocialAppkey:USHARE_DEMO_APPKEY];
    //友盟统计
    UMConfigInstance.appKey = @"USHARE_DEMO_APPKEY";
    UMConfigInstance.channelId = @"App Store";//一般是这样写，用于友盟后台的渠道统计，当然苹果也不会有其他渠道，写死就好
    UMConfigInstance.ePolicy =SEND_INTERVAL; //上传模式，这种为最小间隔发送90S，也可按照要求选择其他上传模式。也可不设置，在友盟后台修改。
    
    [self configUSharePlatforms];
    
    [self confitUShareSettings];
    [[TencentOAuth alloc] initWithAppId:QQAPPID andDelegate:self];
    
    EMOptions *options = [EMOptions optionsWithAppkey:EaseAPPkey];
    options.apnsCertName = ApnsCertName;
    [[EMClient sharedClient] initializeSDKWithOptions:options];
    [[EMClient sharedClient] addDelegate:self delegateQueue:nil];
    
    //添加监听在线推送消息
    [[EMClient sharedClient].chatManager addDelegate:self delegateQueue:nil];
    [self viewAnimation];
   //// WelcomViewController *tabVC = [[WelcomViewController alloc] init];
    
    [WXApi registerApp:WXAPPID];
    
    NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
    
    NSArray * allLanguages = [defaults objectForKey:@"AppleLanguages"];
    
    NSString * preferredLang = [allLanguages objectAtIndex:0];
    if ([preferredLang isEqualToString:@"zh-Hans-CN"]) {
        NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
        [defaults setObject:@"中文" forKey:@"Language"];
    }else if ([preferredLang isEqualToString:@"bo-CN"]){
        NSUserDefaults * defaults = [NSUserDefaults standardUserDefaults];
        [defaults setObject:@"藏文" forKey:@"Language"];
    }else {
        NSLog(@"当前语言:%@", preferredLang);
    }
    [[UIApplication sharedApplication] registerForRemoteNotifications];
   
    [self replyPushNotificationAuthorization:application];
    return YES;
}

-(UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
//    if (self.allowRotation) {//如果设置了allowRotation属性，支持全屏
//        return UIInterfaceOrientationMaskAll;
//    }
    return UIInterfaceOrientationMaskPortrait;//默认全局不支持横屏
}

-(void)replyPushNotificationAuthorization:(UIApplication*)application{
    if (IOS10_OR_LATER) {
        //iOS 10 later
        UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
        //必须写代理，不然无法监听通知的接收与点击事件
        center.delegate = self;
        [center requestAuthorizationWithOptions:(UNAuthorizationOptionBadge | UNAuthorizationOptionSound | UNAuthorizationOptionAlert) completionHandler:^(BOOL granted, NSError * _Nullable error) {
            if (!error && granted) {
                //用户点击允许
                NSLog(@"注册成功");
            }else{
                //用户点击不允许
                NSLog(@"注册失败");
            }
        }];

        // 可以通过 getNotificationSettingsWithCompletionHandler 获取权限设置
        //之前注册推送服务，用户点击了同意还是不同意，以及用户之后又做了怎样的更改我们都无从得知，现在 apple 开放了这个 API，我们可以直接获取到用户的设定信息了。注意UNNotificationSettings是只读对象哦，不能直接修改！
        [center getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
            NSLog(@"========%@",settings);
        }];
    }else if (IOS8_OR_LATER){
        //iOS 8 - iOS 10系统
        UIUserNotificationSettings *settings = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeAlert | UIUserNotificationTypeBadge | UIUserNotificationTypeSound categories:nil];
        [application registerUserNotificationSettings:settings];
    }else{
        //iOS 8.0系统以下
        [application registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound];
    }

    //注册远端消息通知获取device token
}
//监听环信在线推送消息
- (void)messagesDidReceive:(NSArray *)aMessages{
    for(EMMessage *message in aMessages){
        UIApplicationState state = [[UIApplication sharedApplication] applicationState];
        switch (state) {
            case UIApplicationStateBackground:
                [self showNotificationWithMessage:message];
                break;
            default:
                break;
        }
    }
    [self setupUnreadMessageCount];
    
}
- (void)application:(UIApplication *)application
didReceiveRemoteNotification:(NSDictionary *)userInfo {
    NSLog(@"Receive Notify: %@", [userInfo JSONString]);
    NSString *alertStr = [[userInfo objectForKey:@"aps"] objectForKey:@"alert"];
    //收到推送时程序正在前台运行，则给出一个alert，用户选择查看，跳转到指定页面
    if (application.applicationState == UIApplicationStateActive) {
        UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:@"%@", alertStr] delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"查看", nil];
        [alertView show];
    }
    //收到推送时程序在后台运行，点击通知栏中的推送消息，跳转到指定页面
    if (application.applicationState != UIApplicationStateBackground && application.applicationState != UIApplicationStateActive) {


    }

    [application setApplicationIconBadgeNumber:0];
    //[BPush handleNotification:userInfo];
}
// 将得到的deviceToken传给SDK
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken{
    [[EMClient sharedClient] bindDeviceToken:deviceToken];
    
}

// 注册deviceToken失败
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error{
    NSLog(@"%@",error);
}
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
    BOOL result = [[UMSocialManager defaultManager] handleOpenURL:url];
    if (!result) {
        // 其他如支付等SDK的回调
    }
    return result;
}
-(BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options{
    if ([url.host isEqualToString:@"safepay"]) {
    //跳转支付宝钱包进行支付，处理支付结果
    [[AlipaySDK defaultService] processOrderWithPaymentResult:url standbyCallback:^(NSDictionary *resultDic) {
        if ([resultDic[@"resultStatus"] intValue]==9000)
        {
            [[NSNotificationCenter defaultCenter] postNotificationName:@"Ali_PaySuccess" object:nil];
        }else if ([resultDic[@"resultStatus"] intValue]==6001)
        {
            [[NSNotificationCenter defaultCenter] postNotificationName:@"Ali_PayFairl" object:nil];
        }else{
            
        }
    }];
}
    if ([url.scheme isEqualToString:WXAPPID]) {
        [WXApi handleOpenURL:url delegate:self];
        return  YES;
        }else if ([url.scheme isEqualToString:[NSString stringWithFormat:@"tencent%@",QQAPPID]])
        {
        [QQApiInterface handleOpenURL:url delegate:self];
        return [TencentOAuth HandleOpenURL:url];
        }
    return YES;

}
- (void)applicationWillResignActive:(UIApplication *)application {
   
}

#pragma mark ---------------  WXApiDelegate
-(void) onResp:(BaseResp*)resp {
    if ([resp isKindOfClass:[SendMessageToQQResp class]]) {
        SendMessageToQQResp *msg = (SendMessageToQQResp *)resp;
        [_qqDelegate shareSuccssWithQQCode:[msg.result integerValue]];
        
    }
    if ([resp isKindOfClass:[SendAuthResp class]])
    {   //授权登录的类
        SendAuthResp * resp1 = (SendAuthResp *)resp;
            if (resp.errCode == 0)   //成功
            {
                    NSString *wxUrl=[NSString stringWithFormat:@"%@%@",baseURL,API_WECHATLOGIN];
                    NSMutableDictionary *dic=[[NSMutableDictionary alloc]init];
                    dic[@"code"]=resp1.code;
                    dic[@"lang"]=@"zhcn";
                    [[NSUserDefaults standardUserDefaults]setObject:resp1.code forKey:@"WXCode"];
                    AFHTTPSessionManager* manager = [AFHTTPSessionManager manager];
                    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
                    [manager POST:wxUrl parameters:dic progress:^(NSProgress * _Nonnull uploadProgress) {
                    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nullable responseObject) {
                        NSDictionary *json = [NSJSONSerialization JSONObjectWithData:responseObject options:0 error:nil];
                        [_qqDelegate WeChatLogin:json];
                    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
                    }];
                    //3. 获得网络数据赋值给ExpressInfo对                
            }else{
                 NSString *str = [NSString stringWithFormat:@"%@",resp1.errStr];
                UIAlertView *alertview = [[UIAlertView alloc] initWithTitle:@"回调信息" message:str delegate:self cancelButtonTitle:@"确认" otherButtonTitles:nil, nil];
                [alertview show];
            }

        
    }
    
    if ([resp isKindOfClass:[SendMessageToWXResp class]]) {
        SendMessageToWXResp *sendResp = (SendMessageToWXResp *)resp;
        NSString *str;
        if (sendResp.errCode==0) {
            str=@"分享成功";
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [MBProgressHUD showSuccess:str];
            });
        }else if (sendResp.errCode==-2){
            str=@"取消分享";
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [MBProgressHUD showError:str];
            });
        }else{
            str=@"分享失败";
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                [MBProgressHUD showError:str];
            });
        }
        
        
        
    }
    
    if ([resp isKindOfClass:[PayResp class]]) {
        PayResp*response=(PayResp*)resp;  // 微信终端返回给第三方的关于支付结果的结构体
        switch (response.errCode) {
                case WXSuccess:
            {// 支付成功，向后台发送消息
                [[NSNotificationCenter defaultCenter] postNotificationName:@"WX_PaySuccess" object:nil];
            }
                break;
                case WXErrCodeCommon:
            {
                [MBProgressHUD showError:@"支付失败"];
            }
                break;
                case WXErrCodeUserCancel:
            { //用户点击取消并返回
                
               
                //[MBProgressHUD showError:@"取消支付"];
                [[NSNotificationCenter defaultCenter] postNotificationName:@"WX_PayFairl" object:nil];
            }
                break;
                case WXErrCodeSentFail:
            { //发送失败
                [MBProgressHUD showError:@"发送失败"];
            }
                break;
                case WXErrCodeUnsupport:
            { //微信不支持
                //NSLog(@"微信不支持");
                [MBProgressHUD showError:@"微信不支持"];
            }
                break;
                case WXErrCodeAuthDeny:
            { //授权失败
                //NSLog(@"授权失败");
                [MBProgressHUD showError:@"授权失败"];
            }
                break;
            default:
                break;
        }
    }
}





- (void)applicationDidEnterBackground:(UIApplication *)application {
    [[EMClient sharedClient] applicationDidEnterBackground:application];
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    application.applicationIconBadgeNumber = 0;
    [[EMClient sharedClient] applicationWillEnterForeground:application];
}
-(void)applicationDidBecomeActive:(UIApplication *)application{
    NSLog(@"几次了");
}
-(void)showNotificationWithMessage:(EMMessage *)message{
    
    UIApplication *application = [UIApplication sharedApplication];
    application.applicationIconBadgeNumber += 1;
    UILocalNotification *notification =[[UILocalNotification alloc] init];
    //设置10秒之后
    NSDate *pushDate = [NSDate dateWithTimeIntervalSinceNow:1];
    if (notification != nil) {
        // 设置推送时间
        notification.fireDate = pushDate;
        // 设置时区
        notification.timeZone = [NSTimeZone defaultTimeZone];
        // 设置重复间隔
        notification.repeatInterval = 0;
        // 推送声音
        notification.soundName = UILocalNotificationDefaultSoundName;
        // 推送内容
        //notification.alertBody = @"推送内容";
        //显示在icon上的红色圈中的数子
        //notification.applicationIconBadgeNumber += 1;
        //设置userinfo 方便在之后需要撤销的时候使用
        NSDictionary *info = [NSDictionary dictionaryWithObject:@"name"forKey:@"key"];
        notification.userInfo = info;
        //添加推送到UIApplication
        EMMessageBody *msgBody = message.body;
        switch (msgBody.type) {
            case EMMessageBodyTypeText:
            {
                // 收到的文字消息
                EMTextMessageBody *textBody = (EMTextMessageBody *)msgBody;
                NSString *txt = textBody.text;
                notification.alertBody=txt;
                // NSLog(@"收到的文字是 txt -- %@",txt);
            }
                break;
            case EMMessageBodyTypeImage:
            {
                notification.alertBody=@"收到一个图片消息";
            }
                break;
            case EMMessageBodyTypeLocation:
            {
                notification.alertBody=@"收到一个位置消息";
            }
                break;
            case EMMessageBodyTypeVoice:
            {
                notification.alertBody=@"收到一个语音消息";
            }
                break;
            case EMMessageBodyTypeVideo:
            {
                notification.alertBody=@"收到一个视频消息";
            }
                break;
            case EMMessageBodyTypeFile:
            {
                notification.alertBody=@"收到一个文件消息";
            }
                break;
                
            default:
                break;
        }
        UIApplication *app = [UIApplication sharedApplication];
        [app scheduleLocalNotification:notification];
    }
}
- (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification*)notification{
    // 图标上的数字减1
    application.applicationIconBadgeNumber = 0;
    [[UIApplication sharedApplication] cancelAllLocalNotifications];
}
//未读消息
-(void)setupUnreadMessageCount
{
    NSArray *conversations = [[EMClient sharedClient].chatManager getAllConversations];
    NSInteger unreadCount = 0;
    for (EMConversation *conversation in conversations) {
        unreadCount += conversation.unreadMessagesCount;
    }
    if (unreadCount>0) {
        NSNotification *notification =[NSNotification notificationWithName:@"unReadInfo" object:nil userInfo:nil];
        // 3.通过 通知中心 发送 通知
        [[NSNotificationCenter defaultCenter] postNotification:notification];
    }
    
}
- (void)userAccountDidLoginFromOtherDevice
{
    //[self _clearHelper];
    
    NSNotification *notification =[NSNotification notificationWithName:@"lginOther" object:nil userInfo:nil];
    // 3.通过 通知中心 发送 通知
    [[NSNotificationCenter defaultCenter] postNotification:notification];
    //[[NSNotificationCenter defaultCenter] postNotificationName:KNOTIFICATION_LOGINCHANGE object:@NO];
}
- (void)confitUShareSettings
{
    
    
}
- (void)configUSharePlatforms
{
    /*
     设置微信的appKey和appSecret
     [微信平台从U-Share 4/5升级说明]http://dev.umeng.com/social/ios/%E8%BF%9B%E9%98%B6%E6%96%87%E6%A1%A3#1_1
     */
    [[UMSocialManager defaultManager] setPlaform:UMSocialPlatformType_WechatSession appKey:WXAPPID appSecret:WXAPPSecret redirectURL:nil];
    
    
}
////App处于前台接收通知时
- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler{

    //收到推送的请求
    UNNotificationRequest *request = notification.request;

    //收到推送的内容
    UNNotificationContent *content = request.content;

    //收到用户的基本信息
    NSDictionary *userInfo = content.userInfo;

    //收到推送消息的角标
    NSNumber *badge = content.badge;

    //收到推送消息body
    NSString *body = content.body;

    //推送消息的声音
    UNNotificationSound *sound = content.sound;

    // 推送消息的副标题
    NSString *subtitle = content.subtitle;

    // 推送消息的标题
    NSString *title = content.title;

    if([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
        //此处省略一万行需求代码。。。。。。
        NSLog(@"iOS10 收到远程通知:%@",userInfo);

    }else {
        // 判断为本地通知
        //此处省略一万行需求代码。。。。。。
        NSLog(@"iOS10 收到本地通知:{\\\\nbody:%@，\\\\ntitle:%@,\\\\nsubtitle:%@,\\\\nbadge：%@，\\\\nsound：%@，\\\\nuserInfo：%@\\\\n}",body,title,subtitle,badge,sound,userInfo);
    }


    // 需要执行这个方法，选择是否提醒用户，有Badge、Sound、Alert三种类型可以设置
    completionHandler(UNNotificationPresentationOptionBadge|
                      UNNotificationPresentationOptionSound|
                      UNNotificationPresentationOptionAlert);

}


//App通知的点击事件
- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler{
    //收到推送的请求
    UNNotificationRequest *request = response.notification.request;

    //收到推送的内容
    UNNotificationContent *content = request.content;

    //收到用户的基本信息
    NSDictionary *userInfo = content.userInfo;

    //收到推送消息的角标
    NSNumber *badge = content.badge;

    //收到推送消息body
    NSString *body = content.body;

    //推送消息的声音
    UNNotificationSound *sound = content.sound;

    // 推送消息的副标题
    NSString *subtitle = content.subtitle;

    // 推送消息的标题
    NSString *title = content.title;

    if([response.notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) {
        NSLog(@"iOS10 收到远程通知:%@",userInfo);
        //进入医生界面
        EaseConversationListViewController *chatController = [[EaseConversationListViewController alloc]init];
        chatController.title=MyString(@"消息");
        //
        MianTabBarViewController *rootVC = [[MianTabBarViewController alloc] init];
        self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        [self.window setRootViewController:rootVC];
        [self.window addSubview:rootVC.view];
        [self.window makeKeyAndVisible];

        MianTabBarViewController *baseTabBar = (MianTabBarViewController *)self.window.rootViewController;
        [baseTabBar.viewControllers[baseTabBar.selectedIndex] pushViewController:chatController animated:NO];
        //此处省略一万行需求代码。。。。。。

    }else {
        // 判断为本地通知
        //此处省略一万行需求代码。。。。。。
        NSLog(@"iOS10 收到本地通知:{\\\\nbody:%@，\\\\ntitle:%@,\\\\nsubtitle:%@,\\\\nbadge：%@，\\\\nsound：%@，\\\\nuserInfo：%@\\\\n}",body,title,subtitle,badge,sound,userInfo);
        //进入医生界面
        EaseConversationListViewController *chatController = [[EaseConversationListViewController alloc]init];
        chatController.title=MyString(@"消息");
        //
        MianTabBarViewController *rootVC = [[MianTabBarViewController alloc] init];
        self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
        [self.window setRootViewController:rootVC];
        [self.window addSubview:rootVC.view];
        [self.window makeKeyAndVisible];

        MianTabBarViewController *baseTabBar = (MianTabBarViewController *)self.window.rootViewController;
        [baseTabBar.viewControllers[baseTabBar.selectedIndex] pushViewController:chatController animated:NO];
    }
    completionHandler(); // 系统要求执行这个方法
}
//分享直接打开相应的页面
- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *restorableObjects))restorationHandler{
    if ([userActivity.activityType isEqualToString:NSUserActivityTypeBrowsingWeb]) {
        NSURL*webUrl=userActivity.webpageURL;
        if ([webUrl.host isEqualToString:@"www.zjlwh.net"]) {
            //进入医生界面
            EaseConversationListViewController *chatController = [[EaseConversationListViewController alloc]init];
            chatController.title=MyString(@"消息");
            //
            MianTabBarViewController *rootVC = [[MianTabBarViewController alloc] init];
            self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
            [self.window setRootViewController:rootVC];
            [self.window addSubview:rootVC.view];
            [self.window makeKeyAndVisible];

            MianTabBarViewController *baseTabBar = (MianTabBarViewController *)self.window.rootViewController;
            [baseTabBar.viewControllers[baseTabBar.selectedIndex] pushViewController:chatController animated:NO];
        }else{
            [[UIApplication sharedApplication] openURL:webUrl];
        }
    }
    return YES;
}
//启动动画
-(void)viewAnimation{
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.window.backgroundColor = RGB(246, 246, 246);
    MianTabBarViewController *tabVC = [[MianTabBarViewController alloc] init];
    self.window.rootViewController = tabVC;
    [self.window makeKeyAndVisible];
    self.welcomImg=[[UIImageView alloc]initWithFrame:self.window.bounds];
    self.welcomImg.image=[UIImage imageNamed:@"default_bj"];
    self.welcomImg.alpha=0.99;
    [self.window addSubview:self.welcomImg];
    [self.window bringSubviewToFront:self.welcomImg];
    UIImageView*left=[[UIImageView alloc]initWithFrame:CGRectMake(MainW, -0.45*MainW, 0.45*MainW, 0.36*MainW) ];
    left.image=[UIImage imageNamed:@"default_hand_up"];
    //[self.window addSubview:left];
    [self.welcomImg addSubview:left];
    UIImageView*right=[[UIImageView alloc]initWithFrame:CGRectMake(-0.53*MainW, MainH, -0.53*MainW, 0.58*MainW) ];
    right.image=[UIImage imageNamed:@"default_hand_down"];
    //[self.window addSubview:left];
    [self.welcomImg addSubview:right];
    
    [UIView animateWithDuration:2.0f delay:0.0f options:UIViewAnimationOptionTransitionNone animations:^{
        left.frame=CGRectMake(0.55*MainW, 0, 0.45*MainW, 0.36*MainW);
        right.frame=CGRectMake(0, MainH-0.53*MainW, 0.53*MainW, 0.58*MainW);
        self.welcomImg.alpha = 1;
        
    } completion:^(BOOL finished) {
        //[left removeFromSuperview];
        
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [self.welcomImg removeFromSuperview];
            //引导页
            NSArray *array = @[@"引导页A-1", @"引导页A-2", @"引导页A-3", @"引导页A-4"];
            [XNGuideView showGudieView:array];
            
        });
        
    }];
}
//下面三个方法 只是为了去警告。
- (void)tencentDidLogin {
    //去除警告⚠️
}

- (void)tencentDidNotLogin:(BOOL)cancelled {
     //去除警告⚠️
}

- (void)tencentDidNotNetWork {
     //去除警告⚠️ //去除警告⚠️
}
- (void)isOnlineResponse:(NSDictionary *)response {
    //去除警告⚠️
}

- (void)onReq:(QQBaseReq *)req {
    //去除警告⚠️
}

@end
